<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <link rel="stylesheet" th:href="@{/lib/layui-v2.5.5/css/layui.css}" media="all">
    <script th:src="@{/lib/layui-v2.5.5/layui.js}" charset="utf-8"></script>
</head>
<body>
<div id="top" style="width:100%; height: 50px; padding-top:20px; display: flex;">
    <div id="form1" style="width: 40%; height: 100%; padding-left:25%;">
        <form action="/query" method="post">
            <input type="text" name="content" placeholder="输入搜内容" style="width: 70%; height: 26px;">
            <input type="submit" value="搜索" class="layui-btn layui-btn-sm" style="width: 20%;">
        </form>
    </div>
    <a href="/addUser?admin=root" class="layui-btn layui-btn-sm" style="margin-left: 20%;">
        <i class="layui-icon layui-icon-user"></i>添加用户</a>
</div>

<div id="tab" style="width: 100%; height:auto; padding-left:30px;">
<table class="layui-table" style="width: 90%; height: auto;">
    <colgroup>
        <col width="10%">
        <col width="10%">
        <col width="14%">
        <col width="12%">
        <col width="10%">
        <col width="14%">
        <col width="10%">
        <col width="20%">
    </colgroup>
    <thead>
    <tr>
        <!--标题名-->
        <th>用户名</th>
        <th>真实姓名</th>
        <th>手机号码</th>
        <th>邮箱</th>
        <th>密码</th>
        <th>注册时间</th>
        <th>用户类型</th>
        <th>操作</th>
    </tr>
    </thead>
    <tbody>
    <!--循环打印从后台传过来的数据-->
    <tr th:each="user:${AllUser}">
        <td><span th:text="${user.getNickName()}"></span></td>
        <td><span th:text="${user.getRealName()}"></span></td>
        <td><span th:text="${user.getPhone()}"></span></td>
        <td><span th:text="${user.getEmail()}"></span></td>
        <td><span th:text="${user.getPassword()}"></span></td>
        <td><span th:text="${user.getLastLoginTime()}"></span></td>
        <td><span th:if="${user.getManage() eq 'root'}">管理员</span>
            <span th:if="${user.getManage() eq 'common'}">普通用户</span>
        </td>
        <td>
            <a th:href="@{/deleteUser(user_id=${user.getUserId()})}"
               class="layui-btn layui-btn-sm layui-btn-danger"><i class="layui-icon layui-icon-delete"></i>删除</a>
            <a th:href="@{/editUser(user_id=${user.getUserId()})}" class="layui-btn layui-btn-sm" ><i class="layui-icon layui-icon-edit"></i>编辑</a>
        </td>
        </tr>
    </tbody>
</table>
    <span th:text="${usernull}" style="margin: 40px 30%; color:red; font-size: 30px;"></span>
</div>
</body>
</html>